home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.basic;
-
- import com.sun.java.swing.ComboBoxEditor;
- import com.sun.java.swing.JTextField;
- import com.sun.java.swing.border.Border;
- import java.awt.Component;
- import java.awt.event.ActionListener;
- import java.awt.event.FocusEvent;
- import java.awt.event.FocusListener;
- import java.io.Serializable;
-
- public class BasicComboBoxEditor implements ComboBoxEditor, FocusListener, Serializable {
- protected JTextField editor = new BorderlessTextField("", 9);
-
- public BasicComboBoxEditor() {
- this.editor.addFocusListener(this);
- this.editor.setBorder((Border)null);
- }
-
- public void addActionListener(ActionListener l) {
- this.editor.addActionListener(l);
- }
-
- public void focusGained(FocusEvent e) {
- }
-
- public void focusLost(FocusEvent e) {
- this.editor.postActionEvent();
- }
-
- public Component getEditorComponent() {
- return this.editor;
- }
-
- public Object getItem() {
- return this.editor.getText();
- }
-
- public void removeActionListener(ActionListener l) {
- this.editor.removeActionListener(l);
- }
-
- public void selectAll() {
- this.editor.selectAll();
- this.editor.requestFocus();
- }
-
- public void setItem(Object anObject) {
- if (anObject != null) {
- this.editor.setText(anObject.toString());
- } else {
- this.editor.setText("");
- }
-
- }
- }
-